<template>
	<view>
		<u-navbar :safeAreaInsetTop="true" title="积分升值" :autoBack="true" :bgColor="'rgba(255,255,255,'+opc+')'"
			placeholder>

		</u-navbar>

		<view class="pagecon">
			<view class="charts-box">
				<view class="u-flex u-flex-y-center u-flex-between" style="padding: 30rpx;">
					<view class="">
						<view class="charts-box__title">
							积分价格
						</view>
						<view class="charts-box__num">
						</view>
					</view>
					<view class="charts-box__up">
						<u-icon name="arrow-up-fill" size="20rpx" color="#fff"></u-icon>
						<view class="" style="width: 10rpx;">

						</view>
						66%
					</view>
				</view>
				<view class="" style="height: 400rpx;">
					<qiun-data-charts type="line" :opts="opts" :chartData="chartData" />
				</view>
			</view>
			<view class="con__b">
				<view class="con__b__item" @click="navtoU('/pages/points/exchange')">
					<image src="/static/points/dh.png" class="con__b__item__icon" mode=""></image> 购买积分
				</view>
				<view class="con__b__line">

				</view>
				<view class="con__b__item" @click="navtoU('/pages/points/sell')">
					<image src="/static/points/mam.png" style="width: 28rpx;" class="con__b__item__icon" mode="">
					</image>
					出售积分
				</view>
			</view>
			<!-- 			<view class="c">
				<view class="c__t">
					积分升值规则 
				</view>
				<view class="c__te">
					1、积分根据每天实际情况可以实时变动。</br>
					 2、买的人多就升值，卖的人多就跌。
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		userInfo
	} from "@/request/api/my.js"
	export default {
		data() {
			return {
				userInfo: {
					score: 0
				},
				opc: 0,
				chartData: {},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['line'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts: {
					color: ["#FF5151", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [15, 10, 20, 15],
					enableScroll: false,
					legend: {
						show: false
					},
					xAxis: {
						disableGrid: true,

					},
					yAxis: {
						gridType: "solid",
						dashLength: 2,
						data: [{
							tofix: 1
						}]
					},

					extra: {

						line: {
							type: "curve",
							width: 2,
							activeType: "hollow"
						}
					}
				}
			};
		},
		onReady() {
			this.getServerData();
		},
		onShow() {
			userInfo().then(res => {
				this.userInfo = res.data;
			})
		},
		methods: {
			navtoU(url) {
				// uni.$u.toast('开发中');
				uni.navigateTo({
					url
				})
			},
			getServerData() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					let res = {
						categories: ["09-17", "09-18", "09-19", "09-20", "09-21", "09-22"],
						series: [{
							name: "目标值",
							data: [0.6, 0.5, 0.8, 0.5, 0.6, 1.0]
						}]
					};
					this.chartData = JSON.parse(JSON.stringify(res));
				}, 500);
			},
		},
	};
</script>

<style lang="scss">
	.pagecon {
		padding: 30rpx;

		.charts-box {
			background-color: #fff;
			border-radius: 30rpx;

			// height: 600rpx;
			&__title {
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #1E1E1E;
				line-height: 24rpx;
			}

			&__num {
				font-family: DINNextLTPro;
				font-weight: 500;
				font-size: 43rpx;
				color: #1E1E1E;
				line-height: 43rpx;
				margin-top: 20rpx;
			}

			&__tip {
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 400;
				font-size: 24rpx;
				color: #636975;
				line-height: 24rpx;
			}

			&__up {
				padding: 0 14rpx;
				height: 53rpx;
				background: #E3432D;
				border-radius: 15rpx 15rpx 15rpx 15rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-family: DINNextLTPro;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
				line-height: 18rpx;
			}
		}

	}

	.con {
		&__b {
			height: 95rpx;
			background: #FF5151;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			margin-top: 30rpx;
			display: flex;
			align-items: center;
			justify-content: center;

			&__item {
				width: 50%;
				display: flex;
				align-items: center;
				justify-content: center;
				font-family: PingFang-SC, PingFang-SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;

				&__icon {
					width: 32rpx;
					height: 32rpx;
					margin-right: 10rpx;
				}
			}

			&__line {
				width: 1rpx;
				height: 25rpx;
				background: #562620;
				opacity: 0.3;
			}
		}
	}

	.c {
		background: #FEFFFF;
		border-radius: 30rpx 30rpx 30rpx 30rpx;
		padding: 30rpx;
		margin-top: 28rpx;

		&__t {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: 500;
			font-size: 27rpx;
			color: #1E1E1E;
			line-height: 27rpx;
			margin-bottom: 20rpx;
		}

		&__te {
			font-family: PingFang-SC, PingFang-SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #1E1E1E;
			line-height: 36rpx;
		}
	}
</style>